var orderId = getQuery("orderId");
window.onload = function () {
    showOrderInfo()
}

function showOrderInfo() {
    axios.get("/custom/order/findById", {
        params: {
            orderId
        }
    }).then(e => {
        var info = e.data;
        $("idSpan").innerHTML = info.id;
        $("acceptSpan").innerHTML = info.accept;
        $("addressSpan").innerHTML = info.address;
        $("phoneSpan").innerHTML = info.phone;
        $("orderSpan").innerHTML = info.orderDate;
        $("totalPriceSpan").innerHTML = info.totalPrice;
        $("statusSpan").innerHTML = info.status;

        var str = "";
        var infoList = info.detailList;
        for (var i = 0; i < infoList.length; i++) {
            var obj = infoList[i]
            str += `<tr>
                        <td>${obj.product.id}</td>
                        <td>${obj.product.name}</td>
                        <td>${obj.product.price}</td>
                        <td>${obj.num}</td>
                    </tr>`
        }
        $("bodyData").innerHTML = str
    })
}


function returnOrder() {
    location.href = "/custom/order.html";
}